package net.qiqbframework.loadhanding;

import net.qiqbframework.messaging.task.CurrentMessageTask;

import java.util.HashMap;
import java.util.Map;

public class LoadHandingUtil {
    /**
     * 获取加载缓存数据，
     * @param loadMessage
     * @return
     */
    public static Map<String, Object> getLoadCache(LoadMessage<?,?> loadMessage){
        String key =   "_LoadCache<%s>".formatted(loadMessage.getAggregateNaming()+"#"+loadMessage.getBusinessIdName());
        return CurrentMessageTask.get().root().getOrComputeResource(key, s -> new HashMap<>());
    }


}
